package com.four.order.controller;

import com.four.common.utils.R;
import com.four.common.vo.ShoppingVo;
import com.four.order.service.ShoppingService;
import com.four.order.vo.ShoppingPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lky
 * @version 1.0
 * @date 2022/1/13 9:30
 */
@RestController
@RequestMapping("order/shopping")
public class ShoppingController {

    @Autowired
    private ShoppingService shoppingService;

    /**
     * 添加订单
     *
     * @param shoppingVo
     * @return
     */
    @PostMapping("addShopping")
    public R addShopping(@RequestBody ShoppingVo shoppingVo) {

        return shoppingService.addShopping(shoppingVo);
    }

    /**
     * 列表
     *
     * @param shoppingPage
     * @return
     */
    @PostMapping("findAllShopping")
    public R findAllShopping(@RequestBody ShoppingPage shoppingPage) {

        return shoppingService.findAllShopping(shoppingPage);
    }

    /**
     * 查看订单
     * @param orId
     * @return
     */
    @GetMapping("getShowStatus/{orId}")
    public R getShowStatus(@PathVariable("orId") Integer orId) {

        return shoppingService.getShowStatus(orId);
    }

    /**
     * 修改订单状态 已收货
     * @param orId
     * @return
     */
    @GetMapping("updateShowStatus/{orId}")
    public R updateShowStatus(@PathVariable("orId") Integer orId) {

        return shoppingService.updateShowStatus(orId);
    }
}
